

import os


# FIXME; put in options somewhere
WIDTH = 200
HEIGHT = 200

class Track:

    def __init__(self, path, number):
        self._name = None
        self.path = path
        self.tracknumber = number
        self._realpath = None
        self.queued = False

    def isQueued(self):
        return self.queued

    def number(self):
        return self.tracknumber

    def name(self):
        if self._name:
            return self._name
        
        file = os.path.realpath(self.path)[:-4]
        (a,b) = file.split('/')[-1].split('--')
        self._name = ' '.join(b.split('-'))
        return self._name

    def file(self):
        if not self._realpath:
            self._realpath = os.path.realpath(self.path)
        return self._realpath

    def path(self):
        return self.path

    def __cmp__(self,other):
        # only works if "other" is a Track too
        return cmp(self.path,other.path)
